<script src="<?echo $this->webroot;?>js/jquery.easy-ticker.js"></script>

<?php 
	// pr($this->Session->read("country_historical")); 
	// pr($this->Session->read('parametri'));

    $valuteTotal = $this->Session->read("valutalist");
	// pr($bookmaker["Bookmaker"]["categoria"]);
    $categorieTotal = $this->Session->read("categorylist");
?>
<h1 class="text-center"><?php echo __("Bookmakers"); ?></h1>
<div class="row">
        <div class="table-responsive">
        <table class="table-striped table-hover table-condensed text-center table-bordered table-responsive" style="width: 95%;background: #fff;font-size: 12px;">
            <thead>
                <tr style="background-color:#414141;color:#fff;">
                    <th class="text-center"><?php echo __("Logo");?></th>
                    <th class="text-center"><?php echo __("Nome");?></th>
                    <th class="text-center"><?php echo __("Bonus");?></th>
                    <th class="text-center"><?php echo __("Max Bonus");?></th>
                    <th class="text-center"><?php echo __("Mobile");?></th>
                    <th class="text-center"><?php echo __("Streaming");?></th>
                    <th class="text-center"><?php echo __("Categorie");?></th>
                    <th class="text-center"><?php echo __("Valutazione");?></th>
                    <?php if($this->Session->read("Auth.User.isAdministrator")) { ?>
                        <th class="text-center" colspan="2"><?php echo __("Azioni");?></th>
                    <?php } ?>
                        <th class="text-center" colspan=""></th>
                </tr>
            </thead>
            <?php if($this->Session->read("Auth.User.isAdministrator")) { ?>
                <tfoot>
                    <tr class="text-right">
                        <td colspan="13"><a href="<?php echo $this->webroot?>Bookmakers/add"><i class="fa-plus"></i> <?php echo __("Aggiungi un Bookmaker");?></a></td>
                    </tr>
                </tfoot>
            <?php } ?>
            <tbody>
               <?php if(count($bookmakers)==0){ ?>
                 <tr><td colspan="13"><?php echo __("Non hai caricato nessun bookmaker.");?></td></tr>  
                   
               <?php }?>
               <?php foreach($bookmakers as $key=>$bookmaker){?>
               	<?php if(Configure::read("Config.lang")=="it" && $bookmaker["Bookmaker"]["nome"]=="Bet365") continue; ?>
                <tr>
                    <td><a href="<?php echo $this->webroot?>Bookmakers/links/<?php echo $bookmaker["Bookmaker"]["id"]; ?>"><img src="<?php echo $this->webroot.$bookmaker["LogoSlim"]["webpath"];?>" style="width: 50px;" /></a></td>
                    <td><?php echo $bookmaker["Bookmaker"]["nome"]; ?></td>
                    <td><?php echo $bookmaker["Bookmaker"]["bonus"]; ?></td>
                    <td><?php echo $bookmaker["Bookmaker"]["max_importo_bonus"]; ?></td>
                    <td><span class="glyphicon glyphicon-<?php echo $bookmaker["Bookmaker"]["mobile"]?"ok":"remove"; ?>" style="color:<?php echo $bookmaker["Bookmaker"]["mobile"]?"green":"red"; ?>;" ></span></td>
                    <td><span class="glyphicon glyphicon-<?php echo $bookmaker["Bookmaker"]["streaming"]?"ok":"remove"; ?>" style="color:<?php echo $bookmaker["Bookmaker"]["streaming"]?"green":"red"; ?>;"></span></td>
                    <td>
                        <div class='<?php echo !empty($bookmaker["Bookmaker"]["categoria"])?"categoria":""; ?>' >
                          <ul >
                        	<?php foreach(explode(",", $bookmaker["Bookmaker"]["categoria"]) as $categoria){
                                    if($categoria){?>
                                        <li class="label label-warning" style="display: block; font-size: 10px;"  > <?php echo $categorieTotal[$categoria]; ?></li>
                            <?php }}?>
                          </ul>
                        </div>
                    </td>
                    <td>
				       	<?php echo $this->element('star',array("valutazione"=>$bookmaker["Bookmaker"]["valutazione"])); ?>
                    </td>
                    <?php if($this->Session->read("Auth.User.isAdministrator")) { ?>
                        <td><a data-confirm href="<?php echo $this->webroot?>Bookmakers/delete/<?php echo $bookmaker["Bookmaker"]["id"]?>"><i class="fa-trash-o"></i> </a></td>
                        <td><a href="<?php echo $this->webroot?>Bookmakers/edit/<?php echo $bookmaker["Bookmaker"]["id"]?>"><i class="fa-pencil"></i> </a></td>
                    <?php } ?>
                        <td><a class="btn btn-mini btn-danger" href="<?php echo $this->webroot.Configure::read("Config.lang"); ?>/bookmaker/<?php echo $bookmaker["Bookmaker"]["nome_slug"]; ?>"><?php echo __("Dettagli"); ?></a></td>
                </tr>
               <?php }?>
            </tbody>
        </table>
    </div>
</div>
<script>
    $(function() {
      // $('#valuta').vTicker('init', {speed: 700,pause: 2000,margin:3,padding:4});
      $('.categoria').easyTicker({
			direction: 'up',
			easing: 'swing',
			speed: 'slow',
			interval: 4000,
			height: '15px',
			margin:3,padding:4,
			visible: 0,
			mousePause: 1,
			controls: {
				up: '',
				down: '',
				toggle: '',
				playText: 'Play',
				stopText: 'Stop'
			}
			});
    });
</script>
